<template>
  <el-config-provider :locale="elementLocale">
    <router-view></router-view>
  </el-config-provider>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import el_zh_CN from 'element-plus/es/locale/lang/zh-cn'
import el_zh_TW from 'element-plus/es/locale/lang/zh-tw'
import el_en_US from 'element-plus/es/locale/lang/en'
import { usePreferencesStore } from './stores'

const preferencesStore = usePreferencesStore()

const elementLangeuageMap = {
  zh_CN: el_zh_CN,
  zh_TW: el_zh_TW,
  en_US: el_en_US
}

const elementLocale = computed(() => {
  return elementLangeuageMap[preferencesStore.general.lang.currentLangeuage]
})

defineOptions({
  name: 'CoreApp'
})
</script>
